from concurrent.futures import ThreadPoolExecutor
import threading
import time,datetime


def fd_data(listTemp, n):
    for i in range(0, len(listTemp), n):
        yield listTemp[i:i + n]

def thread_list():
    return ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
# 定义一个准备作为线程任务的函数
def action(thread_list):
    starttime = datetime.datetime.now()
    my_sum = 0
    thread_name = threading.current_thread().name
    # print()
    endtime = datetime.datetime.now()
    return thread_name,thread_list,str(starttime),'程序运行时间:' + str(endtime - starttime)
# 创建一个包含4条线程的线程池
with ThreadPoolExecutor(max_workers=4) as pool:
    # 使用线程执行map计算
    # 后面元组有3个元素，因此程序启动3条线程来执行action函数
    results = pool.map(action,thread_list())
    # pool.qsize()
    print('-'*150)
    print(results)
    for r in results:
        print(r)

print("ending...")